#ifndef __AIMAGE_UTILS_H__
#define __AIMAGE_UTILS_H__

#include "apixel.h"

class AIMAGE;

class AIU
{
	public:

	static void cls( AIMAGE &image, PIXVAL r, PIXVAL g, PIXVAL b );
	static void blend( AIMAGE &dst, const AIMAGE &other, float percent );
	static void gamma( AIMAGE &dst, float rg, float gg, float bg );
	static void colour_scale( AIMAGE &dst, float rg, float gg, float bg );
	static void colrange( AIMAGE &dst, 
		float rmin, float rmax,
		float gmin, float gmax,
		float bmin, float bmax
	);
	static void diff( AIMAGE &dst, const AIMAGE &src );
	static float get_noise( const AIMAGE &src );
	static void correct_for_hotmap( AIMAGE &dst, const AIMAGE &hotmap );
	static void correct_for_flatframe( AIMAGE &dst, const AIMAGE &flat);
	static void subtract( AIMAGE &dst, const AIMAGE &src );
	static void edge( AIMAGE &dst, const AIMAGE &src );
	static void stretch( AIMAGE &dst, float mult, float cutoff );
	static void blank_edges( AIMAGE &dst, const AIMAGE &edgemap, float threshold );
	static void sample( AIMAGE &dst, const AIMAGE &src, float scale );
	static void make_flat_invadjust( AIMAGE &dst, const AIMAGE &src );

	private:

	static void test_for_valid_pixel( AIMAGE &dst, int x, int y, int &r, int &g, int &b, int &found_count );
	static void find_closest_pixel( AIMAGE &dst, int xc, int yc );
	static void fill_in_pixel_normal( AIMAGE &dst, int xc, int yc );
	static void fill_in_pixel_dir( AIMAGE &dst, int xc, int yc,
		int xd, int yd, int &r, int &g, int &b, int &samples );
	static void find_pixel( AIMAGE &dst, int xc, int yc, int xd, int yd,
   		APIXEL &p, int &distance );
};

#endif

